/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-11-20 13:45:13
 * @LastEditors: GGB
 * @LastEditTime: 2021-11-20 14:09:52
 */
import { MiddlewareConsumer, Module, NestModule, RequestMethod } from '@nestjs/common';
import { ValidStudentMiddleware } from 'src/common/middlewares/validStudent.middleware';
import { StudentController } from './student.controller';
import { StudentService } from './student.service';

@Module({
    controllers: [StudentController],
    providers: [StudentService],
    exports: [StudentService]
})
export class StudentModule implements NestModule {
    // 中间件
    configure(consumer: MiddlewareConsumer) {
        consumer.apply(ValidStudentMiddleware).forRoutes({
            path: "sutdents/:studentId",
            method: RequestMethod.GET
        })
        consumer.apply(ValidStudentMiddleware).forRoutes({
            path: "sutdents/:studentId",
            method: RequestMethod.PUT
        })

    }

}
